<template>
  <div class="taskbar">

    <!-- 任务栏应用按钮 -->
    <div class="taskbar-apps">
      <TaskbarApp
        v-for="window in visibleWindows"
        :key="window.id"
        :window="window"
        :is-active="activeWindowId === window.id"
        @click="$emit('activate-window', $event)"
      />
    </div>

    <!-- 系统托盘 -->
    <SystemTray
      :time="time"
      :date="date"
      @show-notifications="$emit('show-notifications')"
      @show-calendar="$emit('show-calendar')"
    />
  </div>
</template>

<script setup>
import { computed } from 'vue'
import TaskbarApp from './TaskbarApp.vue'
import SystemTray from './SystemTray.vue'

const props = defineProps({
  windows: {
    type: Array,
    required: true
  },
  activeWindowId: {
    type: String,
    default: null
  },
  time: {
    type: String,
    required: true
  },
  date: {
    type: String,
    required: true
  }
})

defineEmits(['toggle-start-menu', 'activate-window', 'show-notifications', 'show-calendar'])

const visibleWindows = computed(() => {
  return props.windows.filter(w => !w.minimized)
})
</script>

<style scoped>
.taskbar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: rgba(30, 30, 30, 0.95);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 8px;
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
}

/* 开始按钮 */
.start-button {
  width: 48px;
  height: 48px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.start-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.start-icon {
  width: 24px;
  height: 24px;
}

/* 任务栏应用 */
.taskbar-apps {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
}

.taskbar-apps::-webkit-scrollbar {
  display: none;
}
</style>

